package com.rabbiter.pm.controller;

import com.rabbiter.pm.domain.vo.CheckedVo;
import com.rabbiter.pm.domain.vo.LoginInfoVo;
import com.rabbiter.pm.service.SignService;
import com.rabbiter.pm.utils.ResultJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/sign")
public class SignController {
    @Autowired
    private SignService signService;

    /**
     * 签到
     * @param checkedVo
     * @return
     */
    @PostMapping("/in")
    public ResultJson<Object> getStallList(@RequestBody CheckedVo checkedVo){
        Object checkOut = signService.checkOut(checkedVo);
        return ResultJson.success(checkOut);
    }

    /**
     * 补充签到
     * @param checkedVo
     * @return
     */
    @PostMapping("/reIn")
    public ResultJson<Object> reIn(@RequestBody CheckedVo checkedVo){
        Object checkIn = signService.checkIn(checkedVo);
        return ResultJson.success(checkIn);
    }
    /**
     * 查询所有签到的用户
     */
    @GetMapping("/all")
    public ResultJson<Object> selectAll(){
        Object all = signService.selectAll();
        return ResultJson.success(all);
    }
    /**
     * 清空签到表
     */
    @GetMapping("/delete")
    public ResultJson<Object> deleteAll(){
        Object all = signService.deleteAll();
        return ResultJson.success(all);
    }

}
